function flow_window() {
    flow_window.prototype.init = function (data) {
        var that=this;
        this.data = data;
        $("#" + that.data.id).prepend(`
        <div style="width:${that.data.width};height:${that.data.height};bottom:${that.data.bottom};left:${that.data.left};top:${that.data.top};right:${that.data.right};${that.data.style}" class="dialog" id="dialog_${that.data.id}">
            <div style="${that.data.head_style}" class="dialog_head" id="move_part_${that.data.id}">${that.data.title}</div>
            <div class="dialog_content">${that.data.content}</div>
        </div>
        `);
        //声明需要用到的变量
        var mx = 0,my = 0;      //鼠标x、y轴坐标（相对于left，top）
        var dx = 0,dy = 0;      //对话框坐标（同上）
        var isDraging = false;      //不可拖动
        //鼠标按下
        g(`move_part_${that.data.id}`).addEventListener('mousedown',function(e){
            var e = e || window.event;
            mx = e.pageX;      //点击时鼠标X坐标
            my = e.pageY;      //点击时鼠标Y坐标
            dx = g(`dialog_${that.data.id}`).offsetLeft;
            dy = g(`dialog_${that.data.id}`).offsetTop;
            isDraging = true;      //标记对话框可拖动
                //鼠标移动
                document.onmousemove = function(e){
                    var e = e || window.event;
                    var x = e.pageX;      //移动时鼠标X坐标
                    var y = e.pageY;      //移动时鼠标Y坐标
                    if(isDraging){        //判断对话框能否拖动
                        var moveX = dx + x - mx;      //移动后对话框新的left值
                        var moveY = dy + y - my;      //移动后对话框新的top值
                        g(`dialog_${that.data.id}`).style.left = moveX +'px';       //重新设置对话框的left
                        g(`dialog_${that.data.id}`).style.top =  moveY +'px';     //重新设置对话框的top
                        //设置拖动范围
                        var pageW = document.documentElement.clientWidth;
                        var pageH = document.documentElement.clientHeight;
                        var dialogW = g(`dialog_${that.data.id}`).offsetWidth;
                        var dialogH = g(`dialog_${that.data.id}`).offsetHeight;
                        var maxX = pageW - dialogW;       //X轴可拖动最大值
                        var maxY = pageH - dialogH;       //Y轴可拖动最大值
                        moveX = Math.min(Math.max(0,moveX),maxX);     //X轴可拖动范围
                        moveY = Math.min(Math.max(0,moveY),maxY);     //Y轴可拖动范围

                        g(`dialog_${that.data.id}`).style.left = moveX +'px';       //重新设置对话框的left
                        g(`dialog_${that.data.id}`).style.top =  moveY +'px';        //重新设置对话框的top
                    };
            };
        });
        console.log(that.data.id)

        //鼠标离开
        g(`move_part_${that.data.id}`).addEventListener('mouseup',function(){
            isDraging = false;
        });
    }
    flow_window.prototype.open = function(){
        g(`dialog_${this.data.id}`).style.display = 'block';
        if(this.data.autoCenter==true){
            autoCenter(g(`dialog_${this.data.id}`));
        }
    }
    flow_window.prototype.close = function(){
        g(`dialog_${this.data.id}`).style.display = 'none';
    }
    function g(id){return document.getElementById(id)};
    function autoCenter(el){
        //获取可见窗口大小
        var bodyW = document.documentElement.clientWidth;
        var bodyH = document.documentElement.clientHeight;
        //获取对话框宽、高
        var elW = el.offsetWidth;
        var elH = el.offsetHeight;

        el.style.left = (bodyW - elW)/2 + 'px';
        el.style.top = (bodyH - elH)/2 + 'px';
    };

    

}